#ifndef ECSINGLETON_H
#define ECSINGLETON_H

template<typename T>class EcSingleton
{
protected:
    static T* ms_Singleton;
public:
    EcSingleton(void)
    {
        ms_Singleton = static_cast<T*>(this);
    }

    ~EcSingleton(void)
    {
        (void)(ms_Singleton);
        ms_Singleton = 0;
    }

    static T& getSingleton(void)
    {
        (void)(ms_Singleton);
        return (*ms_Singleton);
    }
};

template <typename T>
T* EcSingleton<T>::ms_Singleton = 0;

#endif // ECSINGLETON_H
